<template>
<div class="ui form FWZList" >
    <table class="ui celled table" v-show='FWZListData.length>0'>
        <thead>
            <tr>
                <th>操作</th>
                <th>名称</th>
            </tr>
        </thead>
        <tbody>
            <tr v-for='{id,tzuid,status,server_name} in FWZListData'>
                <td>
					<button class="ui button" v-if='status==0' @click.stop.prevent='changeStatus(id,tzuid,1)'>启用</button>
					<button class="ui button" v-if='status==1' @click.stop.prevent='changeStatus(id,tzuid,0)'>禁用</button>
                    <button  type="button" class="ui secondary button"  @click.stop.prevent='changeFWZ(id,tzuid)'>编辑</button>
                </td>
                <td>{{server_name}}</td>
            </tr>
        </tbody>
    </table>
</div>
</template>
<script>
import tool from 'src/util/tool';
import util from '_util/index';
import logic from '_logic';

import tTable from 'components/tunit/tTable';
import tFields from 'components/tunit/tFields';

// import latlonMap from 'components/tunit/tmodel/latlonMap';

export default {
    data() {
        return {
			FWZListData:[]
		}
    },
    computed: {
	},
    components: {},
    watch: {
		list:{
			handler: function(val,old){
				console.log(111)
				this.FWZListData = val;
			},
			 deep: true
		}
	},
    methods: {
        onchange({
            name,
            value
        }) {
        },
		changeStatus(id,tzuid,status){
			util.http.SR(this, '/index/Op/add_qdcodetz', {
				id,
				scode:this.params.scode,
				tzu_id:tzuid,
				status
			}, '操作成功', (rs) => {
				this.$emit("reload", {
				});
			});
		},
		changeFWZ(id,tzuid){
			let _this = this;
			util.store.push(this, 'set_in_modal','in_modal',false,true,'global');
			util.store.get(this,'eventVue').$emit('showPopCom', {
				_this,
				id,
				data: {
					fn: {
						sure: function(data) {
							util.http.SR(_this, '/index/Op/add_qdcodetz', {
								id,
								scode:_this.params.scode,
								tzu_id:data.id,
							}, '添加成功', (rs) => {
								_this.$emit("reload", {
								});
							});
						}
					},
					field: {
						bindModel: 15,
						"data_type": 1,
	                    "bind_type": 0,
						title: '添加服务者',
						name: 'id',
						fval:tzuid,
						bind_name_field: 'name',
						bind_param:`type=1&isSearch=1`,
						search_field:'name'
					}
				},
				hide_in_model:true,
				name: 'Jbind'
			});
		},
        onsubmit(form) {

        },
        oncancel() {

        },
    },
    props: {
		params: {
			type: Object,
			default: function() {
				return {}
			}
		},
        list: {
            type: Array,
            default: function() {
                return []
            }
        }
    },

    created() {},
}
</script>
<style scoped lang="less">
@import "../../../common/style/mixin";
.FWZList{
	margin-bottom: 15px
}

</style>
